package edu.pku.sei.act.sampletask.car;

import edu.pku.sei.act.sampletask.AutonomicParking;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.RemoteException;

public class _WaitingForResponse extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {
		new Thread(new Runnable() {
			
			@Override
			public void run() {
				try {
					Thread.sleep(2000);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
				if(AutonomicParking.getCurrentState().equals(_Car.state.QUERYING_PARKING_SLOT)) {//TODO not safe?
					try {
						AutonomicParking.setState(_Car.state.STOPPED);
					} catch (RemoteException e) {
						e.printStackTrace();
					}
				}
			}
		}).start();
	}

}
